package markgame2dphys;

import java.awt.Color;

import net.phys2d.math.Vector2f;
import net.phys2d.raw.BasicJoint;

public class MarkGameBasicJoint extends MarkGameJoint{

	public BasicJoint joint;

	public MarkGameBasicJoint(MarkGameObject obj1, MarkGameObject obj2, Vector2f anchor) {
		super(new BasicJoint(obj1.body, obj2.body, anchor));
		joint = (BasicJoint)super.joint;
	}

	public void paint(MarkGameGraphics g) {

		int r = 2;

		g.setColor(Color.RED);

		Vector2f anchor1 = MarkGameUtils.convertLocalToGlobal(joint.getBody1(), (Vector2f)joint.getLocalAnchor1());
		g.drawCircle(anchor1.x, anchor1.y, r);

		Vector2f anchor2 = MarkGameUtils.convertLocalToGlobal(joint.getBody2(), (Vector2f)joint.getLocalAnchor2());
		g.drawCircle(anchor2.x, anchor2.y, r);

		Vector2f anchorc = new Vector2f((anchor1.x+anchor2.x)/2, (anchor1.y+anchor2.y)/2);
		g.drawCircle(anchorc.x, anchorc.y, r);
		
		//g.drawLine(Math.round(anchor1.x), Math.round(anchor1.y), Math.round(anchor2.x), Math.round(anchor2.y));

	}


}
